###############################
# definitions

ADD_DEFINITIONS(
    -DPACKAGE_NAME=${PACKAGE_NAME}
    -DPACKAGE_STRING=${PACKAGE_STRING}
    -DPACKAGE_BUGREPORT=${PACKAGE_BUGREPORT}
    -DPACKAGE_URL=${PACKAGE_URL}
    -DPACKAGE=${PACKAGE}
    -DVERSION=${VERSION}
)

IF(UNIX OR MINGW)
ADD_DEFINITIONS(
    -g -ggdb
)
ENDIF(UNIX OR MINGW)

IF(UNIX AND NOT CYGWIN)
ADD_DEFINITIONS(
    -fPIC
)
ENDIF(UNIX AND NOT CYGWIN)

ADD_DEFINITIONS(-D__STDC_FORMAT_MACROS)

IF(CMAKE_CL_64)
    ADD_DEFINITIONS(-DWIN64)
ENDIF(CMAKE_CL_64)

IF(MSVC)
  ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
ENDIF(MSVC)


###############################
# includes

INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../include ${CMAKE_CURRENT_SOURCE_DIR}/src/utils)
IF(MSVC)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../include/msinttypes)
ENDIF(MSVC)

###############################
# sources

file(GLOB_RECURSE TESTNGPP_SRCS ./*.cpp ./*.c)

set(TESTNGPP_MAIN_SRC ./runner/TestRunnerMain.cpp)

list(REMOVE_ITEM ${TESTNGPP_SRCS} ${TESTNGPP_MAIN_SRC})

###############################
# targets

ADD_LIBRARY(testngpp2 STATIC ${TESTNGPP_SRCS})
ADD_LIBRARY(testngpp2_main STATIC ${TESTNGPP_MAIN_SRC})

INSTALL(
  TARGETS testngpp2 testngpp2_main
  ARCHIVE DESTINATION lib)
